<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>ARToolKitPlus: ARToolKitPlus::MemoryManager Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.6-NO -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li id="current"><a href="annotated.html"><span>Classes</span></a></li>
    <li><a href="dirs.html"><span>Directories</span></a></li>
  </ul></div>
<div class="tabs">
  <ul>
    <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
    <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
    <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
  </ul></div>
<div class="nav">
<b>ARToolKitPlus</b>::<a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html">MemoryManager</a></div>
<h1>ARToolKitPlus::MemoryManager Class Reference</h1><!-- doxytag: class="ARToolKitPlus::MemoryManager" --><a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html">MemoryManager</a> defines a basic interface for a custom memory manager to be uses by ARToolKitPlus.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;MemoryManager.h&gt;</code>
<p>
<a href="class_a_r_tool_kit_plus_1_1_memory_manager-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#df867b36b186a041e11da840388638a2">init</a> (size_t nNumInitialBytes, size_t nNumGrowBytes=0)=0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The <a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html">MemoryManager</a> will allocate an initial amount of memory.  <a href="#df867b36b186a041e11da840388638a2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#5a40d0be023dd17e542553b7b9aa6e1d">deinit</a> ()=0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Releases all memory alloced previously.  <a href="#5a40d0be023dd17e542553b7b9aa6e1d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="bb9263722c9de45d9287b61beb648810"></a><!-- doxytag: member="ARToolKitPlus::MemoryManager::didInit" ref="bb9263722c9de45d9287b61beb648810" args="()=0" -->
virtual bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#bb9263722c9de45d9287b61beb648810">didInit</a> ()=0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns true if the <a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html">MemoryManager</a> was already initialized. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#363fe1f6f6b40ad8580394a24ae95b1b">getMemory</a> (size_t nNumBytes)=0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Reserves nNumBytes from previously allocated memory.  <a href="#363fe1f6f6b40ad8580394a24ae95b1b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4894245aa67e46ecd96871a3203400e6"></a><!-- doxytag: member="ARToolKitPlus::MemoryManager::releaseMemory" ref="4894245aa67e46ecd96871a3203400e6" args="(void *nMemoryBlock)=0" -->
virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#4894245aa67e46ecd96871a3203400e6">releaseMemory</a> (void *nMemoryBlock)=0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Releases a memory block that was allocated via <a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#363fe1f6f6b40ad8580394a24ae95b1b">getMemory()</a>. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3728fb5e3e9b600d1a3980ce0e4bfc2d"></a><!-- doxytag: member="ARToolKitPlus::MemoryManager::getBytesAllocated" ref="3728fb5e3e9b600d1a3980ce0e4bfc2d" args="()=0" -->
virtual unsigned int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#3728fb5e3e9b600d1a3980ce0e4bfc2d">getBytesAllocated</a> ()=0</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the number of bytes allocated alltogether. <br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
<a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html">MemoryManager</a> defines a basic interface for a custom memory manager to be uses by ARToolKitPlus. 
<p>
In various situations it makes sense to have a custom memory manager rather than using the default new/delete functions provided by the c-runtime. To use a custom memory manager it has to be set using ARToolKitPlus::setMemoryManager() before ARToolKitPlus is instantiated. If no memory manager is set, ARToolKitPlus will use the default new/delete functions. 
<p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="5a40d0be023dd17e542553b7b9aa6e1d"></a><!-- doxytag: member="ARToolKitPlus::MemoryManager::deinit" ref="5a40d0be023dd17e542553b7b9aa6e1d" args="()=0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual bool ARToolKitPlus::MemoryManager::deinit           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Releases all memory alloced previously. 
<p>
After <a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#5a40d0be023dd17e542553b7b9aa6e1d">deinit()</a> has been called <a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#363fe1f6f6b40ad8580394a24ae95b1b">getMemory()</a> will not be able to reserve memory anymore. <a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#5a40d0be023dd17e542553b7b9aa6e1d">deinit( )</a> releases all memory allocated previously. It is not required to call <a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#4894245aa67e46ecd96871a3203400e6">releaseMemory()</a> after <a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#5a40d0be023dd17e542553b7b9aa6e1d">deinit()</a>.     </td>
  </tr>
</table>
<a class="anchor" name="363fe1f6f6b40ad8580394a24ae95b1b"></a><!-- doxytag: member="ARToolKitPlus::MemoryManager::getMemory" ref="363fe1f6f6b40ad8580394a24ae95b1b" args="(size_t nNumBytes)=0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual void* ARToolKitPlus::MemoryManager::getMemory           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">size_t&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>nNumBytes</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Reserves nNumBytes from previously allocated memory. 
<p>
<a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#df867b36b186a041e11da840388638a2">init()</a> hast to be called before getMemory can be invoked.     </td>
  </tr>
</table>
<a class="anchor" name="df867b36b186a041e11da840388638a2"></a><!-- doxytag: member="ARToolKitPlus::MemoryManager::init" ref="df867b36b186a041e11da840388638a2" args="(size_t nNumInitialBytes, size_t nNumGrowBytes=0)=0" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">virtual bool ARToolKitPlus::MemoryManager::init           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">size_t&nbsp;</td>
          <td class="mdname" nowrap> <em>nNumInitialBytes</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>size_t&nbsp;</td>
          <td class="mdname" nowrap> <em>nNumGrowBytes</em> = <code>0</code></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [pure virtual]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
The <a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html">MemoryManager</a> will allocate an initial amount of memory. 
<p>
Each time the <a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html">MemoryManager</a> does not have enough memory left for a <a class="el" href="class_a_r_tool_kit_plus_1_1_memory_manager.html#363fe1f6f6b40ad8580394a24ae95b1b">getMemory()</a> request it will allocate another block of nNumGrowBytes bytes.     </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li>MemoryManager.h</ul>
<hr size="1"><address style="align: right;"><small>Generated on Wed Jul 26 18:59:55 2006 for ARToolKitPlus by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6-NO </small></address>
</body>
</html>
